print all keys having same value

49

print all keys having same value -

dict = {"Jim": "y", "Bob": "y", "Ravioli": "n"}
In [26]: [k for k,v in dict1.items() if v == 'y']
Out[26]: ['Bob', 'Jim']

Comments

Submit
0 Comments